package cn.mazexal.exambg.models.enums;

import lombok.Getter;

@Getter
public enum ExamStatus {

    UN_START(0, "未开始"),

    DOING(1, "进行中"),

    FINISH(2, "已完成"),

    PAUSE(3, "暂停中"),

    CANCEL(4, "已取消");

    private Integer code;
    private String desc;

    ExamStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ExamStatus getByCode(Integer code) {
        for (ExamStatus value : ExamStatus.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
